package com.peak.spring.boot.api.entity;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import com.peak.spring.boot.api.constant.Constants;

/**
 * 主键使用另一表的主键，主要是one to one的时候用到，这里写的是user，其他表的话没必要继承此类
 * @author Haley Gao
 *
 */
@MappedSuperclass
public abstract class ForeignIdentity extends Identity {

	private static final long serialVersionUID = Constants.SERIAL_VERSION;

	@Id
	@GenericGenerator(name = "pkGenerator", strategy = "foreign", parameters = @Parameter(name = "property", value = "user"))
	@GeneratedValue(generator = "pkGenerator")
	public Integer getId() {
		return id;
	}

}
